package com.njtcedu.microblog.website.home.service;

import java.io.IOException;
import java.util.List;

import javax.inject.Inject;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
import org.springframework.web.multipart.MultipartFile;

import com.njtcedu.microblog.intranet.systemconfig.web.response.AdImageResponse;
import com.njtcedu.microblog.website.home.repository.HomeRepository;
import com.njtcedu.microblog.website.home.web.request.UserRegisterRequest;
import com.njtcedu.microblog.website.home.web.response.CurrentUser;

@Service
@Transactional
public class HomeService {

	@Inject
	private HomeRepository homeRepository;
	
	public void register(UserRegisterRequest request) {
		homeRepository.register(request);
	}
	
	
	public CurrentUser login(String account, String password) {
		return homeRepository.login(account, password);
	}
	
	public AdImageResponse uploadAdImage(MultipartFile imageFile, String evePath, CurrentUser currentUser) throws IOException {
		return homeRepository.uploadAdImage(imageFile, evePath, currentUser);
	}
	
	public List<CurrentUser> getTop10User() {
		return homeRepository.getTop10User();
	}
}
